#ifndef __IMA_TCP_REQUEST_MAKER_H__
#define __IMA_TCP_REQUEST_MAKER_H__

#include <string>

using namespace std;

typedef struct jsondata{
	union {
		char buffer[2];
		int nSize;
	} sizeofdata;
	int nBytesRead;
	char* pData;
} JSONDATA;

class ImaTcpRequestMaker {
	private:
		int createConnection();
		int read_size_of_receivable_data(int fd, JSONDATA* pJsonData);
		int read_receivable_data(int fd, JSONDATA* pJsonData);

	public:
		ImaTcpRequestMaker(char* pHost, int port);
//		static ImaTcpRequestMaker* getInstance(char* pHost, int port);
		~ImaTcpRequestMaker();
		int makeRequest(const char* pRequestStr, std::string& responseStr);

	private:
		int mSockFd;
		char mHostname[256];
		int mPort;
		//static ImaTcpRequestMaker* mpInstance;
};

#endif //__IMA_TCP_REQUEST_MAKER_H__
